﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.ComponentModel;

namespace UMFramework.UI.Compoment
{
    [Description("支持了特定鼠标移动效果的按钮")]
	public partial class Button
	{
        public Button()
		{
			this.InitializeComponent();
			// 在此点之下插入创建对象所需的代码。
		}

        private Image _ButtonImage;
        /// <summary>
        ///     按钮图像
        /// </summary>
        [Description("对于按钮上图像的支持")]
        [Category("控件自定义属性")]
        public Image ButtonImage
        {
            get { return _ButtonImage; }
            set
            {
                _ButtonImage = value;
                this.Img.Source = _ButtonImage.Source;
            }
        }

        private BtnType _ButtonType;
        /// <summary>
        ///     按钮类型
        /// </summary>
        [Description("对于按钮的效果分类")]
        [Category("控件自定义属性")]
        [DefaultValue(typeof(BtnType), "ImageAndText")]
        public BtnType ButtonType
        {
            get { return _ButtonType; }
            set
            {
                _ButtonType = value;
                if (_ButtonType == BtnType.ImageAndText)
                {
                    this.Img.Visibility = Visibility.Visible;
                    this.txt_Name.Visibility = Visibility.Visible;
                    this.txt_InnerName.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.Img.Visibility = Visibility.Collapsed;
                    this.txt_Name.Visibility = Visibility.Collapsed;
                    this.txt_InnerName.Visibility = Visibility.Visible;
                }
            }
        }

        private String _Text;
        /// <summary>
        ///     按钮文字
        /// </summary>
        [Description("对于按钮的下标文字")]
        [Category("控件自定义属性")]
        [DefaultValue("Button")]
        public String Text
        {
            get { return _Text; }
            set 
            { 
                _Text = value;
                this.txt_Name.Text = _Text;
                this.txt_InnerName.Text = _Text;
                this.txt_InnerName.HorizontalAlignment = HorizontalAlignment.Center;
            }
        }

        public enum BtnType
        {
            TextOnly,
            ImageAndText
        }
	}
}